<?php /*a:3:{s:73:"E:\phpstudy_pro\WWW\YZNCMS-master\application\admin\view\custom\edit.html";i:1629795599;s:74:"E:\phpstudy_pro\WWW\YZNCMS-master\application\admin\view\index_layout.html";i:1629258949;s:67:"E:\phpstudy_pro\WWW\YZNCMS-master\application\admin\view\layui.html";i:1629258949;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>YZNCMS后台管理系统</title>
    <meta name="author" content="YZNCMS">
    <meta name="csrf-token" content="<?php echo think\facade\Request::token('__token__'); ?>">
    <link rel="stylesheet" href="/static/libs/layui/css/layui.css">
    <link rel="stylesheet" href="/static/admin/css/admin.css?v=<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>">
    <link rel="stylesheet" href="/static/common/font/iconfont.css?v=<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>">
    <script src="/static/libs/layui/layui.js"></script>
    <script src="/static/libs/jquery/jquery.min.js"></script>
    <script type="text/javascript">
    //全局变量
    var GV = {
        'site':<?php echo json_encode($site); ?>,
        'image_upload_url': '<?php echo !empty($image_upload_url) ? htmlentities($image_upload_url) :  url("attachment/upload/upload", ["dir" => "images", "module" => request()->module()]); ?>',
        'file_upload_url': '<?php echo !empty($file_upload_url) ? htmlentities($file_upload_url) :  url("attachment/upload/upload", ["dir" => "files", "module" => request()->module()]); ?>',
        'ueditor_upload_url': '<?php echo !empty($ueditor_upload_url) ? htmlentities($ueditor_upload_url) :  url("attachment/upload/upload", ["dir" => "images","from"=>"ueditor", "module" => request()->module()]); ?>',
    };
    </script>
</head>

<body class="childrenBody <?php echo defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''; ?>">
    
<style>
    .type-select{
        display:none;
    }
</style>
<form class="layui-form" method="post">
    <div class="layui-form-item">
        <label class="layui-form-label"> <span class="bitian">*</span> 字段名称 </label>
        <div class="layui-input-block">
            <input type="text" name="title" value="<?php echo htmlentities($custom['title']); ?>" lay-verify="required" autocomplete="off" placeholder="字段名称" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label"> <span class="bitian">*</span> 字段类型 </label>
        <div class="layui-input-block">
            <select name="field_type" id="" class="layui-disabled" disabled lay-filter="field">
                <option value="">请选择类型</option>
                <option <?php if($custom['field_type'] == 'text'): ?> selected <?php endif; ?> value="text">文本</option>
                <option <?php if($custom['field_type'] == 'number'): ?> selected <?php endif; ?> value="number">数字</option>
                <option <?php if($custom['field_type'] == 'time'): ?> selected <?php endif; ?> value="time">时间</option>
                <option <?php if($custom['field_type'] == 'files'): ?> selected <?php endif; ?> value="files">附件</option>
                <option <?php if($custom['field_type'] == 'radio'): ?> selected <?php endif; ?> value="radio">单选框</option>
                <option <?php if($custom['field_type'] == 'checkbox'): ?> selected <?php endif; ?> value="checkbox">复选框</option>
                <option <?php if($custom['field_type'] == ''): ?> selected <?php endif; ?> value="">关联对象</option>
                <option <?php if($custom['field_type'] == ''): ?> selected <?php endif; ?> value="">关联属性</option>
            </select>
        </div>
    </div>
    <input type="hidden" name="type" value="<?php echo htmlentities($type); ?>">
    <input type="hidden" name="id" value="<?php echo htmlentities($custom['id']); ?>">
    <?php if($custom['field_type'] == 'text'): ?>
        <div id="text">
            <div class="layui-form-item">
                <label class="layui-form-label"> 允许扫码输入 </label>
                <div class="layui-input-block">
                    <select name="is_scan" id="">
                        <option <?php if($customDetail['is_can'] == 0): ?> selected <?php endif; ?> value="0">否</option>
                        <option <?php if($customDetail['is_can'] == 1): ?> selected <?php endif; ?> value="1">是</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"> 可修改扫码结果 </label>
                <div class="layui-input-block">
                    <select name="can_edit_scan" id="">
                        <option <?php if($customDetail['can_edit_scan'] == 0): ?> selected <?php endif; ?> value="0">否</option>
                        <option <?php if($customDetail['can_edit_scan'] == 1): ?> selected <?php endif; ?> value="1">是</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"> 隐藏条件 </label>
                <div class="layui-input-block">
                    <button class="layui-btn layui-btn-green" type="button">添加</button>
                    <span>当满足此条件时此字段隐藏</span>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"> 字段属性 </label>
                <div class="layui-input-block">
                    <input name="attribute_text[]" <?php if(strpos($customDetail['attribute'],'1') !== false): ?> checked <?php endif; ?> value="1" type="checkbox" title="只读">
                    <input name="attribute_text[]" <?php if(strpos($customDetail['attribute'],'3') !== false): ?> checked <?php endif; ?> value="3" type="checkbox" title="多行">
                    <input name="attribute_text[]" <?php if(strpos($customDetail['attribute'],'2') !== false): ?> checked <?php endif; ?> value="2" type="checkbox" title="必填">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"> 引导文字 </label>
                <div class="layui-input-block">
                    <input type="text" name="placeholder" value="<?php echo htmlentities($customDetail['placeholder']); ?>" autocomplete="off" placeholder="填写完显示在框里" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"> 提示说明 </label>
                <div class="layui-input-block">
                    <textarea name="tips" cols="30" rows="10"><?php echo htmlentities($customDetail['tips']); ?></textarea>
                </div>
            </div>
        </div>
    <?php elseif($custom['field_type'] == 'number'): ?>
    <div id="number">
        <div class="layui-form-item">
            <label class="layui-form-label"> 隐藏条件 </label>
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-green" type="button">添加</button>
                <span>当满足此条件时此字段隐藏</span>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 字段属性 </label>
            <div class="layui-input-block">
                <input name="attribute_number[]" <?php if(strpos($customDetail['attribute'],'1') !== false): ?> checked <?php endif; ?> value="1" type="checkbox" title="只读">
                <input name="attribute_number[]" <?php if(strpos($customDetail['attribute'],'2') !== false): ?> checked <?php endif; ?> value="2" type="checkbox" title="必填">
                <input name="attribute_number[]" <?php if(strpos($customDetail['attribute'],'3') !== false): ?> checked <?php endif; ?> value="3" type="checkbox" title="显示千分位分割符">
                <input name="attribute_number[]" <?php if(strpos($customDetail['attribute'],'4') !== false): ?> checked <?php endif; ?> class="numbers" lay-filter="numbers" value="4" type="checkbox" title="小数位数">
                <?php if(strpos($customDetail['attribute'],'4') !== false): ?>
                <input type="number" value="<?php echo htmlentities($customDetail['xiaoshu']); ?>" name="xiaoshu" placeholder="请输入小数位数">
                <?php else: ?>
                <input type="number" style="display: none;" name="xiaoshu" placeholder="请输入小数位数">
                <?php endif; ?>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 引导文字 </label>
            <div class="layui-input-block">
                <input type="text" name="placeholder" value="<?php echo htmlentities($customDetail['placeholder']); ?>" autocomplete="off" placeholder="填写完显示在框里" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 提示说明 </label>
            <div class="layui-input-block">
                <textarea name="tips" cols="30" rows="10"><?php echo htmlentities($customDetail['tips']); ?></textarea>
            </div>
        </div>
    </div>
    <?php elseif($custom['field_type'] == 'time'): ?>
    <div id="time">
        <div class="layui-form-item">
            <label class="layui-form-label"> 隐藏条件 </label>
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-green" type="button">添加</button>
                <span>当满足此条件时此字段隐藏</span>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 字段属性 </label>
            <div class="layui-input-block">
                <input name="attribute_time[]" <?php if(strpos($customDetail['attribute'],'1') !== false): ?> checked <?php endif; ?> value="1" type="checkbox" title="只读">
                <input name="attribute_time[]" <?php if(strpos($customDetail['attribute'],'2') !== false): ?> checked <?php endif; ?> value="2" type="checkbox" title="必填">
            </div>
        </div>
    </div>
    <?php elseif($custom['field_type'] == 'files'): ?>
    <div id="files">
        <div class="layui-form-item">
            <label class="layui-form-label"> 隐藏条件 </label>
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-green" type="button">添加</button>
                <span>当满足此条件时此字段隐藏</span>
            </div>
        </div>
    </div>
    <?php elseif($custom['field_type'] == 'radio'): ?>
    <div id="radio">
        <div class="layui-form-item radio-select">
            <label class="layui-form-label"> 设置可选范围 </label>
            <?php if(is_array($customDetail['select']) || $customDetail['select'] instanceof \think\Collection || $customDetail['select'] instanceof \think\Paginator): $i = 0; $__LIST__ = $customDetail['select'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$item): $mod = ($i % 2 );++$i;?>
            <div class="layui-input-block">
                <input type="text" value="<?php echo htmlentities($item); ?>" name="values[]" style="width:50%;" class="layui-input">
            </div>
            <?php endforeach; endif; else: echo "" ;endif; ?>
        </div>
        <button class="layui-btn layui-btn-xs add-line" type="button" style="margin-left:20%;">新增可选项</button>
        
        <div class="layui-form-item" style="margin-top: 2em;">
            <label class="layui-form-label"> 隐藏条件 </label>
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-green" type="button">添加</button>
                <span>当满足此条件时此字段隐藏</span>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 字段属性 </label>
            <div class="layui-input-block">
                <input name="attribute_radio[]" <?php if(strpos($customDetail['attribute'],'1') !== false): ?> checked <?php endif; ?> value="1" type="checkbox" title="必选">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 引导文字 </label>
            <div class="layui-input-block">
                <input type="text" name="placeholder" value="<?php echo htmlentities($customDetail['placeholder']); ?>" autocomplete="off" placeholder="填写完显示在框里" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 提示说明 </label>
            <div class="layui-input-block">
                <textarea name="tips" cols="30" rows="10"><?php echo htmlentities($customDetail['tips']); ?></textarea>
            </div>
        </div>
    </div>
    <?php elseif($custom['field_type'] == 'checkbox'): ?>
    <div id="checkbox" class="type-select">
        <div class="layui-form-item checkbox-select">
            <label class="layui-form-label"> 设置可选范围 </label>
            <div class="layui-input-block">
                <input type="text" name="checkbox-values[]" style="width:50%;" class="layui-input">
            </div>
        </div>
        <button class="layui-btn layui-btn-xs add-line-checkbox" type="button" style="margin-left:20%;">新增可选项</button>
        
        <div class="layui-form-item" style="margin-top: 2em;">
            <label class="layui-form-label"> 隐藏条件 </label>
            <div class="layui-input-block">
                <button class="layui-btn layui-btn-green" type="button">添加</button>
                <span>当满足此条件时此字段隐藏</span>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 字段属性 </label>
            <div class="layui-input-block">
                <input name="attribute_checkbox[]" value="1" type="checkbox" title="必填">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 引导文字 </label>
            <div class="layui-input-block">
                <input type="text" name="placeholder" autocomplete="off" placeholder="填写完显示在框里" class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"> 提示说明 </label>
            <div class="layui-input-block">
                <textarea name="tips" cols="30" rows="10"></textarea>
            </div>
        </div>
    </div>
    <?php endif; ?>
    <div class="layui-form-item layer-footer">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter='ds' type="button" data-refresh="false">立即提交</button>
            <button class="layui-btn layui-btn-normal" type="button" onclick="var index1 = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index1);">返回</button>
        </div>
    </div>
</form>

    
    <script type="text/javascript">
layui.config({
	version: '<?php echo htmlentities(app('config')->get('version.yzncms_release')); ?>',
	base: '/static/libs/layui_exts/'
}).extend({
	yzn: 'yzn/yzn',
	yznForm: 'yznForm/yznForm',
	yznTable: 'yznTable/yznTable',
	treeGrid: 'treeGrid/treeGrid',
	clipboard: 'clipboard/clipboard',
	notice: 'notice/notice.min',
	iconPicker: 'iconPicker/iconPicker.min',
	ztree: 'ztree/ztree',
	dragsort: 'dragsort/dragsort.min',
	tagsinput: 'tagsinput/tagsinput',
	xmSelect: 'xmSelect/xm-select',
	selectPage: 'selectPage/selectpage.min',
	echarts: 'echarts/echarts',
	echartsTheme: 'echarts/echartsTheme',
	citypicker: 'citypicker/city-picker',
	webuploader: 'webuploader/webuploader',
	ueditor: 'ueditor/ueditor.min',
}).use('yznForm');
</script>
    
    
<script>
    layui.use(['form'], function() {
        var form = layui.form;
        var $ = layui.jquery;
        $('.add-line').on('click',function(){
            var _html = '<div class="layui-input-block">'+
                '<input type="text" name="values[]" style="width:50%;float:left;"" class="layui-input">'+
                '<button class="layui-btn layui-btn-xs layui-btn-danger remove-radio" style="margin-top: 0.5em;margin-left: 1em;">移除</button><div style="clear: both;"></div>'+
            '</div>';
            $('.radio-select').append(_html);
        })
        $('body').on('click','.remove-radio',function(){
            $(this).parent('.layui-input-block').remove();
        })
        
        $('.add-line-checkbox').on('click',function(){
            var _html = '<div class="layui-input-block">'+
                '<input type="text" name="checkbox-values[]" style="width:50%;float:left;"" class="layui-input">'+
                '<button class="layui-btn layui-btn-xs layui-btn-danger remove-checkbox" style="margin-top: 0.5em;margin-left: 1em;">移除</button><div style="clear: both;"></div>'+
            '</div>';
            $('.checkbox-select').append(_html);
        })
        $('body').on('click','.remove-checkbox',function(){
            $(this).parent('.layui-input-block').remove();
        })
        form.on('checkbox(numbers)',function(data){
            var status = $(".numbers").prop("checked");
            if(status){
                $('input[name="xiaoshu"]').css('display','inline-block');
            }else{
                $('input[name="xiaoshu"]').css('display','none');
            }
        })
        form.on('select(field)',function(data){
            $('.type-select').css('display','none');
            var type = data.value;
            $('#'+type).css('display','block');
        })
        form.on('submit(ds)',function(data){
            var param = data.field;
            $.post('<?php echo url("editPost"); ?>',param,function(res){
                if(res.code > 0){
                    layer.msg('编辑成功');
                    setTimeout(() => {
                        var index1 = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index1);
                        parent.location.reload();
                    }, 500);
                }else{
                    layer.msg(res.msg);
                }
            },'json');
        })
    });
</script>

</body>

</html>